package atom.core3.j2ee.privilege;

import javax.servlet.http.HttpServletRequest;

import atom.core2.j2ee.util.SessionManager;
import atom.core3.j2ee.privilege.bean.LoginSessionInfo;
import atom.core3.j2ee.privilege.bean.SessionPrivilegeResource;

/**
 * 用户登录过滤
 * 
 * @author aps-zmc
 * 
 */
public class SessionPrivilegeFilter extends PrivilegeFilter
{

	private static final long serialVersionUID = 1L;
	
	protected LoginSessionInfo isLogin(HttpServletRequest request,String uri){
		// 是否已登录.
		//SessionPrivilegeResource resource = (SessionPrivilegeResource)request.getSession().getAttribute(SessionManager.SESSION_USER);
		Object o = SessionManager.getUserSessionObject(request);
		if (o==null)
			return null;
		SessionPrivilegeResource resource = (SessionPrivilegeResource)o;
		return PrivilegeResourceManager.getLoginSessionInfo(resource,uri);
	}
	protected LoginSessionInfo isLogin(HttpServletRequest request){
		// 是否已登录.
		//SessionPrivilegeResource resource = (SessionPrivilegeResource)request.getSession().getAttribute(SessionManager.SESSION_USER);
		Object o = SessionManager.getUserSessionObject(request);
		if (o==null)
			return null;
		SessionPrivilegeResource resource = (SessionPrivilegeResource)o;
		return PrivilegeResourceManager.getLoginSessionInfo(resource);
	}
}
